package com.xgame.common.exception;

/**
 * xgame自定义异常
 * @author Topin(潘清山)
 * @date 2013-9-14
 */
public class XgameException extends Exception {
	
	private static final long serialVersionUID = 229084464194752283L;

	/*错误码*/
	protected int code;
	
	public XgameException(int code) {
		this.code = code;
	}

	public XgameException(int code, String msg) {
		super(msg);
		this.code = code;
	}

	public XgameException(int code, String msg, Throwable e) {
		super(msg, e);
		this.code = code;
	}

	public XgameException(int code, Throwable e) {
		super(e);
		this.code = code;
	}

	public int getCode() {
		return code;
	}

	public String getMessage() {
		return (new StringBuilder()).append("[").append(code).append("] ")
				.append(super.getMessage()).toString();
	}
}
